import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import AdminData from '../components/AdminData.vue'
import AdminUser from '../components/AdminUser.vue'
import AdminKnowledge from '../components/AdminKnowledge.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/home',
    name: 'home',
	redirect: '/home/user',
    component: HomeView,
	children: [
	  {
	    path: 'data', // 子路由路径
	    name: 'data',
	    component: AdminData
	  },
	  {
	    path: 'user',
	    name: 'user',
	    component: AdminUser
	  },
	  {
		path:'knowledge',
		name: 'knowledge',
		component:AdminKnowledge
	  }
	]
  },
  {
	path: '/login',
	name: 'login',
	component: LoginView  
  }
]

const router = new VueRouter({
  routes
})

export default router
